<script setup lang="ts">
const props = defineProps<{
  isSearch: boolean
}>()

const emits = defineEmits(['update:isSearch'])

function closeSearch() {
  emits('update:isSearch', false)
}
</script>

<template>
  <div class="mask" v-if="props.isSearch">
    <div class="close">
      <i class="fa fa-close" @click="closeSearch"></i>
    </div>
    <div class="ipt">
      <input type="text" placeholder="search">
      <i class="fa fa-search"></i>
    </div>

  </div>
</template>

<style scoped lang="less">
.mask {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, .4);
  z-index: 9999;
}

.close {
  position: absolute;
  right: 10px;
  top: 10px;
  display: flex;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background-color: rgba(225, 224, 224, .6);
  cursor: pointer;

  i {
    color: #fff; 
    font-size: 18px;
  }
}

.ipt {
  display: flex;
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 40%;

  input {
    width: 100%;
    border: none;
    outline: none;
    border: 1px solid #efeeee;
    padding: 10px 50px 10px 20px;
    font-size: 16px;
    border-radius: 30px;
    font-family: PingFang SC, sans-serif;
    transition: all .4s;
  }

  i {
    position: absolute;
    right: 22px;
    top: 12px;
    font-size: 18px;
    color: rgba(0, 0, 0, .3);
    cursor: pointer;
  }
}
</style>
